<div>
  <div class="d-input">
    <input dTextInput style="width: 180px;" [error]="false" placeholder="销售发货单" name="销售发货单"
      [(ngModel)]="fifter.SaleDeliverNum">
    <input dTextInput style="width: 180px;" [error]="false" placeholder="物料编码/名称" [(ngModel)]="fifter.SearchTermPart">
    <input *ngIf="!this.data.customerName" dTextInput style="width: 180px;" [error]="false" placeholder="客户名称" [(ngModel)]="fifter.SearchTermCustomer">
    <d-button id="primaryBtn" style="margin-left: 8px" (btnClick)="filter2()"><i
        class="icon icon-filter-o me-2"></i>查询</d-button>
    <d-button bsStyle="common" (btnClick)="reset()"> <i class="icon icon-refresh me-2"></i>重置</d-button>
  </div>
  <div class="mt-3">
    <d-data-table [lazy]="true" [dataSource]="tableData" [scrollable]="true" [fixHeader]="true"
      [maxHeight]="tableheight" [resizeable]="true" [tableOverflowType]="'auto'" [scrollable]="true" [resizeable]="true" [maxHeight]="'400px'"
      [colDraggable]="true" [tableWidthConfig]="tableWidthConfig" (checkAllChange)="getCheckedRows();getCheckedRowsData()"
      (rowCheckChange)="getCheckedRows();getCheckedRowsData()">
      <thead dTableHead [checkable]="true">
        <tr dTableRow>
          <th dHeadCell *ngFor="let colOption of dataTableOptions.columns" [fixedLeft]="colOption.fixedLeft">{{
            colOption.header }}</th>
        </tr>
      </thead>
      <tbody dTableBody>
        <ng-template let-rowItem="rowItem" let-rowIndex="rowIndex" let-nestedIndex="nestedIndex">
          <tr dTableRow>
            <td dTableCell [fixedLeft]="'0px'">
              <d-checkbox [disabled]="false" [showAnimation]="true" [ngModelOptions]="{ standalone: true }"
                [ngModel]="rowItem.$checked" dTooltip [halfchecked]="rowItem.$halfChecked" [showGlowStyle]="false"
                (ngModelChange)="onRowCheckChange($event, rowIndex, nestedIndex, rowItem)" [disabled]="this.data.saleDeliverPartIds.includes(rowItem.saleDeliverPartId)"></d-checkbox>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'" [fixedLeft]="'80px'">
              <span>{{ rowItem?.saleDeliverNum}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{ rowItem?.chineseName}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{ rowItem?.partNum}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{ rowItem?.partName}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{rowItem.partType}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{rowItem.partUOM}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{rowItem.scheduledDeliverAmount}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{rowItem.scheduledDeliverAmount-rowItem.returnedAmount}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{rowItem.priceWithTax}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{rowItem.amountWithTax}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{rowItem.taxAmount}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{rowItem.discount*100}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{rowItem.discountPriceWithTax}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{rowItem.discountAmountWithTax}}</span>
            </td>
            <td dTableCell [rowItem]="rowItem" [field]="'showType'">
              <span>{{rowItem.discountTaxAmount}}</span>
            </td>

          </tr>
        </ng-template>
      </tbody>
    </d-data-table>
  </div>
  <div class="page-footer">
    <div>
      <p>已选 <span class="underline">{{CheckedRows.length}}</span> 条
        <a (click)="cleared()" class="cleared">清空</a>
      </p>
    </div>
    <d-pagination [size]="'sm'" [canViewTotal]="true" [canChangePageSize]="true" [canJumpPage]="true" [maxItems]="5"
      [total]="this.pager.total" [pageSizeOptions]="this.pageSizeOptions" [(pageSize)]="fifter.PageSize"
      [(pageIndex)]="fifter.PageNumber" (pageIndexChange)="pageIndexChange($event)"
      (pageSizeChange)="pageSizeChange($event)">
    </d-pagination>
  </div>
</div>
